package com.example.demo.service.impl;

import com.example.demo.dto.CourseInfo;
import com.example.demo.dto.CourseVo;
import com.example.demo.entity.Course;
import com.example.demo.mapper.CourseMapper;
import com.example.demo.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    @Override
    public int insertCourse(CourseVo course) {
        return courseMapper.insertCourse(course);
    }

    @Override
    public int deleteCourseById(int id) {
        return courseMapper.deleteCourseById(id);
    }

    @Override
    public int updateCourse(Course course) {
        return courseMapper.updateCourse(course);
    }

    @Override
    public Course selectCourseById(int id) {
        return courseMapper.selectCourseById(id);
    }

    @Override
    public List<Course> selectAllCourses() {
        return courseMapper.selectAllCourses();
    }


    @Override
    public List<CourseInfo> getAllCourses() {
        return courseMapper.getAllCourses();
    }

    //根据id查信息
    @Override
    public CourseInfo getCourseById(int id) {
        return courseMapper.getCourseById(id);
    }
}
